//课程模块排序
function module_sort(update_seq_url){
	$("h3.item-move").bind('mouseover',function(){
		$(this).css("cursor", "move");
	});
	var $module_block = $(".plan-list");
	$module_block.sortable({
		opacity: 0.6,
		revert: true,
		cursor: 'move',
		handle: '.item-move',
		update: function() {
			var module_seq = [];
			$module_block.find(".item-move").each(function() {
				module_seq.push($(this).attr("objid"));
			});
			module_seq = module_seq.join(',');
			$.ajax({
				type: "post",
				dataType:'json',
				url: update_seq_url,
				data: {module_seq:module_seq},
				success:function(data) {
		        	if(data.status == '0') {
    	        		art.dialog({
	    	        	    icon: 'error',
	    	        	    content: data.info,
	    	        	    time:2
	    	        	});
    	        	}
		        },
		        error:function(data){
		        	art.dialog({
		        	    icon: 'error',
		        	    content: '更新失败！',
		        	    time:2
		        	});
		        }
			});
		}
	});
}


//班级排序
function class_sort(update_seq_url){
	$("span.item-move").bind('mouseover',function(){
		$(this).css("cursor", "move");
	});
	var $class_block = $(".catalog-content");
	$class_block.sortable({
		opacity: 0.6,
		revert: true,
		cursor: 'move',
		handle: '.item-move',
		update: function() {
			var class_seq = [];
			$class_block.children(".class-item").each(function() {
				class_seq.push(this.title);
			});
			class_seq = class_seq.join(',');
			$.ajax({
				type: "post",
				dataType:'json',
				url: update_seq_url,
				data: {class_seq:class_seq},
				success:function(data) {
		        	if(data.status == '0') {
    	        		art.dialog({
	    	        	    icon: 'ok',
	    	        	    content: data.info,
	    	        	    time:1
	    	        	});
    	        	}
		        },
		        error:function(data){
		        	art.dialog({
		        	    icon: 'error',
		        	    content: '更新失败！',
		        	    time:2
		        	});
		        }
			});
		}
	});
}

//小组排序
function group_sort(update_seq_url){
	$("span.group-name").bind('mouseover',function(){
		$(this).css("cursor", "move");
	});
	var $group_block = $("ul.group-list");
	$group_block.sortable({
		opacity: 0.6,
		revert: true,
		cursor: 'move',
		handle: '.group-name',
		update: function() {
			var group_seq = [];
			$group_block.children(".group-item").each(function() {
				group_seq.push(this.title);
			});
			group_seq = group_seq.join(',');
			$.ajax({
				type: "post",
				dataType:'json',
				url: update_seq_url,
				data: {group_seq:group_seq},
				success:function(data) {
		        	if(data.status == '0') {
    	        		art.dialog({
	    	        	    icon: 'ok',
	    	        	    content: data.info,
	    	        	    time:1
	    	        	});
    	        	}
		        },
		        error:function(data){
		        	art.dialog({
		        	    icon: 'error',
		        	    content: '更新失败！',
		        	    time:2
		        	});
		        }
			});
		}
	});
}
//测验题目排序
function test_sort(objid, update_modseq_url){
	$(".module-title").bind('mouseover',function(){
		$(this).css("cursor", "move");
	});
	var $show = $("#loader"); //进度条
	var $list = $(".block_"+objid);
	$list.sortable({
		opacity: 0.6,
		revert: true,
		cursor: 'move',
		handle: '.module-title',
		update: function(){
			var new_item_info = [];
			$list.children(".ac_test").each(function() {
				new_item_info.push(this.title);
			});
			var item_info = new_item_info.join(',') + ',';
			$.ajax({
				type: "post",
				url: update_modseq_url,
				data: {item_info:item_info, objid:objid},
				beforeSend: function() {
					$show.html("正在更新,请稍等哦！:)");
				},
				success: function(msg) {
					//location.reload(true);
				}
			});
		}
	});
}